package com.xiaomaoguai.hessian.controller;

import com.billionsfinance.hessian.server.DemoServer;
import com.billionsfinance.hessian.server.HelloServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class HelloController {

    private HelloServer helloServer;

    private DemoServer demoServer;

    @Autowired
    public HelloController(HelloServer helloServer, DemoServer demoServer) {
        this.helloServer = helloServer;
        this.demoServer = demoServer;
    }

    @RequestMapping("/hello")
    public String hello() {
        return helloServer.sayHello("zhang");
    }

    @RequestMapping("/demo")
    public int demo() {
        return demoServer.add(5, 10);
    }
}
